namespace Vwf.Vwt {
	public class BlockVala : Block {
		public string? code = null;
		public string? name = null;
		public enum Type { Init, PreRender, Render, Eval, EvalEscape, Expression, Delegate, Callback }
		public Type type;
		public override string? codeRender() {
			switch(type) {
				case Type.Eval: 
					return "response.write(" + code + ");";
					// break;
				case Type.EvalEscape:
					return "response.write(Tools.Html.EncodeHtml(" + code + "));";
				case Type.Render:
					return code;
					// break;
			};
			return null;
		}
		
		public override string? codePreRender() {
			return type == Type.PreRender ? code : null;
		}
		
		public override string? codeInit() {
			return type == Type.Init ? code : null;
		}
		
		public BlockVala(string iCode = "") {
			code = iCode;
		}
	}
}
